﻿using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;

namespace MD5Checksum
{
    class Program
    {
        static void Main(string[] args)
        {
            if (args.Length == 0) return;
            var md5 = MD5.Create();
            for (var y = 0; y < args.Length; ++y)
            {
                byte[] bytes = null;
                if (File.Exists(args[y]))
                {
                    bytes = File.ReadAllBytes(args[y]);
                }
                var md5Hash = md5.ComputeHash(bytes);
                var stringBuilder = new StringBuilder();
                for (int i = 0; i < md5Hash.Length; ++i)
                {
                    stringBuilder.Append(md5Hash[i].ToString("x2"));
                }
                Console.WriteLine(args[y] + "--" + stringBuilder.ToString());
            }
            Console.ReadLine();
        }
    }
}
